<!DOCTYPE html>
<html lang="en">

	<head>
		<title>Matrix Admin</title>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" href="/css/bootstrap.min.css" />
		<link rel="stylesheet" href="/css/bootstrap-responsive.min.css" />
		<link rel="stylesheet" href="/css/uniform.css" />
		<link href="/font-awesome/css/font-awesome.css" rel="stylesheet" />
	</head>
	<body>
		<div id="content">
			<div class="container-fluid">
				<hr>
				<div class="row-fluid">
					<div class="span12">
						<div class="widget-box">
							<div class="widget-title"> 
							</div>
							<div class="widget-content nopadding">
								<table class="table table-bordered table-striped">
									<thead>
										<tr>
											<th><span style="opacity: 1;"><input type="checkbox"  /></span> </th>
											<th>服务名称</th>
											<th>服务IP</th>
											<th>用户名</th>
											<th>密码</th>
											<th>描述</th>
											<th>根目录</th>
										</tr>
									</thead>
									<tbody>
										<#list servers as server >
											<tr class="odd gradeX">
												<td><input type="checkbox" value="${server.server_id}" /> </td>
												<td>${server.server_name}</td>
												<td>${server.server_ip}</td>
												<td>${server.server_user}</td>
												<td>${server.server_pwd}</td>
												<td>${server.server_desc}</td>
												<td>${server.config_dir}</td>
											</tr>
										</#list>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
			<script src="/js/jquery.min.js"></script>
			<script src="/js/jquery.ui.custom.js"></script>
			<script src="/js/bootstrap.min.js"></script>
			<script src="/js/jquery.uniform.js"></script>
			<script src="/js/select2.min.js"></script>
			<script src="/js/jquery.dataTables.min.js"></script>
			<script src="/js/matrix.js"></script>
			<script src="/js/matrix.tables.js"></script>
			<script src="/layer/layer.js"></script>
			<script type="text/javascript">
			
				// 添加主机
				function syncConfHandler(){
					
					var param = {};
					param['configId'] = '${configId}';
					param['hosts'] = getSelectHost()+'';
					
					layer.confirm('确认同步当前配置到设备吗？', {
					  btn: ['同步','取消'] //按钮
					}, function(){
					 	$.ajax({
							type: "POST",
							url: "/confsync/sync",
							data: param,
							success: function(data) {
								parent.location.reload();
							}
						});
					});
				}
				
				function getSelectHost(){
					
					var inputs = $("table tbody tr td input");
					var selectInput = new Array()
					
					for (var i = 0; i< inputs.length; i ++) {
						var input = inputs[i];
						
						if (input.checked == true) {
							selectInput.push($(input).val());
						}
					}
					return selectInput;
				}
				
			</script>
	</body>

</html>